-- Leviathan (c) v.v.balashoff
local Class = require('leviathan/Class')

local TweenSystem = Class:derive('UITweenSystem')

function TweenSystem:new(domain)
    self.name = 'TweenSystem'
    self.domain = domain
end

function TweenSystem:update(dt)
    local r = self.domain.components['Tween']
    -- TODO remove it?
    if r then
        for _, c in pairs(r) do
            if c.enabled and c.entity.enabled then
                -- start check
                if not c.start then
                    c.start = love.timer.getTime()
                    c.tween:reset()
                end
-- TODO changed
--                    local prev = c.tween.clock
                c.tween:update(dt)
--                    if not (prev == c.tween.clock) then
--                        u.changed = true
--                    end
            end
        end
    end
end

return TweenSystem
